package 实验二;

import java.util.List;

public class Teacher {
    private String id;           // 编号
    private String name;         // 姓名
    private String gender;       // 性别
    private String title;        // 职称
    private List<Course> courses; // 所授课程列表

    public Teacher(String id, String name, String gender, String title, List<Course> courses) {
        this.id = id;
        this.name = name;
        this.gender = gender;
        this.title = title;
        this.courses = courses;
    }

    // 添加课程
    public void addCourse(Course course) {
        courses.add(course);
    }

    // 开课方法，显示教师的所有课程
    public void openCourses() {
        for (Course course : courses) {
            System.out.println(title + " " + name + "（编号：" + id + "）开设课程《" + course.getCourseName() + "》，上课地点：" + course.getLocation() + "，时间：" + course.getTime() + "。");
        }
    }

    // getter 和 setter 方法
    public String getId() { return id; }
    public void setId(String id) { this.id = id; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public String getGender() { return gender; }
    public void setGender(String gender) { this.gender = gender; }
    public List<Course> getCourses() { return courses; }
    public void setCourses(List<Course> courses) { this.courses = courses; }
}
